home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
090
/
cmln0985.arc
/
TESTPROG.BAS
< prev
Wrap
BASIC Source File
|
1986-02-27
|
2KB
|
40 lines
500 ' ================PARSER TESTING PROGRAM======================
505 ' (Warning: this is a kludge !!)
510 '
515 ' Assumes lines 10-499 of merged data program contains node info
520 ' in the following form: first, the number of nodes (+1); next,
525 ' for each node, a list of numbers (terminated by 0) the first
530 ' element of which is an index into CD$ designating the character
535 ' set accepted by that node, and the remaining elements of which
540 ' are the nodes which are the given node's possible successors in
545 ' the transition diagram.
550 ' The next set of data is for the defining the character sets
555 ' CD$(I), and consists of the the number of these sets (+ 1),
560 ' followed by strings containing those sets. So that control
565 ' characters and quote marks can be included, any character occuring
570 ' twice in a row is replaced by ASC(that character)-32.
575 '
580 ' Change MERGE command in next line as desired.
585 '
590 CHAIN MERGE "EXAMPLE1",595,DELETE 590-590
595 DEFINT A-Z: RESTORE 10
600 READ L : DIM NN$(L),ND(L)
605 FOR CN=0 TO L
610 READ ND(CN):READ I:WHILE I>0:NN$(CN)=NN$(CN)+CHR$(I):READ I:WEND
615 NEXT
620 READ L:DIM CD$(L)
625 FOR I=0 TO L
630 READ CD$(I)
635 FOR CN=1 TO LEN(CD$(I))-1
640 IF MID$(CD$(I),CN,1)=MID$(CD$(I),CN+1,1) THEN CD$(I)=LEFT$(CD$(I),CN-1)+CHR$(ASC(MID$(CD$(I),CN))-32)+RIGHT$(CD$(I),LEN(CD$(I))-CN-1)
645 NEXT
650 NEXT
655 '
660 ' Now that the data is all set up, let's test the program:
665 '
670 CHAIN MERGE "PARSER",675,ALL,DELETE 670-670
675 PRINT : PRINT "ANOTHER:"; : GOSUB 1000 : GOTO 675
680 END
gram:
665 '
670 CHAIN MERGE